package com.service.Hua.Impl;

import com.mapper.Hua.MaterialWarehouseInMapper;
import com.pojo.Hua.HuaMaterial;
import com.pojo.Hua.HuaMaterialInWarehouse;
import com.pojo.Hua.HuaMaterialPly;
import com.pojo.Hua.Staff;
import com.service.Hua.IMaterialWarehouseInService;
import com.util.Res;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class MaterialWarehouseInServiceImpl implements IMaterialWarehouseInService {
    @Autowired
    MaterialWarehouseInMapper materialWarehouseInMapper;
    @Override
    public List<HuaMaterialInWarehouse> getInWarehouse() {
        return materialWarehouseInMapper.getInWarehouse();
    }

    @Override
    public List<HuaMaterial> getMaterials() {
        return materialWarehouseInMapper.getMaterials();
    }

    @Override
    public List<HuaMaterialPly> getMaterialPly() {
        return materialWarehouseInMapper.getMaterialPly();
    }

    @Override
    public List<Staff> getStaff() {
        return materialWarehouseInMapper.getStaff();
    }

    @Override
    public Integer getMaxCode() {
        return materialWarehouseInMapper.getInWarehouseMaxCode();
    }

    @Override
    public Res addInMaterialWarehouse(HuaMaterialInWarehouse huaMaterialInWarehouse) {
        Res res = new Res();
        int i = materialWarehouseInMapper.addInMaterialWarehouse(huaMaterialInWarehouse);
        if (i>0){
            res.setCode(200);
        }else {
            res.setCode(401);
        }
        return res;
    }
}
